<style lang="less">
  // .main .content-wrapper {
  //   padding: 0;
  //   height: calc(100% - 80px);
  //   overflow: auto;
  // }
  .card_style {
    height: 100%;
    width: 100%;
    overflow: hidden;
    .ivu-card-body {
      padding: 0px;
    }
  }
  .page_style {
    margin-top: 10px;
    text-align: right;
  }
  .bench_search {
    margin-bottom: 10px;
  }
  .nopadding .ivu-table-cell {
    padding: 0px 0px;
  }
  .item1{
    height: 42px;
    line-height: 40px;
  }
  .new-btn-sty {
    margin-right: 5px;
    color: #fff;
    background-color: #235CA7;
    border-color: #235CA7;
    font-weight: 500;
  }
  .new-btn-sty2 {
    margin-right: 20px;
    color: #fff;
    background-color: #ff0101;
    border-color: #ff0000;
    font-weight: 500;
  }
</style>

<template>
  <div>
    <Row class="bench_search">
      <Col span="6">
        <span>社区账号：</span>
        <Input style="width: 70%;" v-model="searchInfo.account" />
      </Col>
      <Button class="new-btn-sty" @click="searchData()"><Icon type="ios-search" /> 搜索</Button>
    </Row>
    <div style="margin-top: 20px">
      <Table border :columns="columns2" :data="datalist2">
      </Table>
      <Page :total="totpage" style="margin-top: 10px;float:right" @on-change="changePageNo"/>
    </div>
  </div>
</template>
<script>
import { findLoginList } from '@/api/eventlist.js'
export default {
  name: 'communityinfo',
  data () {
    return {
      modal: false,
      modal1: false,
      modal2: false,
      totpage: 0,
      pagesize: 10,
      pageno: 1,
      columns2: [
        { title: '社区名称', key: 'company_name', width: 120, align: 'center' },
        { title: '社区账号', key: 'login_code', width: 120, align: 'center' },
        { title: '登录账号', key: 'login_name', width: 120, align: 'center' },
        { title: '登录IP', key: 'ip', width: 130, align: 'center' },
        { title: '登录系统', key: 'login_system_name', width: 120, align: 'center' },
        { title: '信息', key: 'result', width: 200, align: 'center' },
        { title: '登录时间', key: 'create_time', width: 220, align: 'center' },
        { title: '浏览器', key: 'browser', width: 120, align: 'center' }
      ],
      datalist: [],
      searchInfo: {
        account: ''
      },
      datalist2: [],
      company_map: {},
      reset: {
        ccode: '',
        isshow: false,
        inscode: ''
      }
    }
  },
  computed: {
    companyCode () {
      return this.$store.state.user.severUserInfo.company_code
    }
  },
  methods: {
    changePageNo (pageNo) {
      this.pageno = pageNo
      this.searchData()
    },
    searchData () { // 根据账号搜索功能
      this.datalist = []
      this.datalist2 = []
      let params = {
        account: this.searchInfo.account,
        pageSize: this.pagesize,
        pageNo: this.pageno
      }
      findLoginList(params).then(res => {
        console.log(res.data.data)
        if (res.data.errcode === 0) {
          this.datalist2 = res.data.data.results
          this.totpage = res.data.data.totalRecord
        } else {
          this.$Notice.error({
            title: '获取社区信息失败',
            desc: res.data.errmsg
          })
        }
      })
    }
  },
  mounted () {
    this.searchData()
    console.log(this.companyCode, 'companyCodecompanyCode')
  }
}
</script>
